package com.wp.targetOffer;

/**
 * Created by 王萍 on 2017/7/29 0029.
 */

/**
 * 我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形，总共有多少种方法？
 */
public class 矩形覆盖 {
    public static void main(String[] args) {
        System.out.println(RectCover(5));
    }

    public static int RectCover(int target) {
        if(target==0)
            return 0;
        int before = 1, after = 2;
        while (target-- != 1) {
            after += before;
            before = after - before;
        }
        return before;
    }
}
